<template>
  <el-dialog title="审核" :close-on-click-modal="false" :visible.sync="visible">
    <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
      <el-form-item label="审核" prop="verify_status">
        <el-radio v-model="dataForm.verify_status" label="1">审核通过</el-radio>
        <el-radio v-model="dataForm.verify_status" label="2">审核不通过</el-radio>
      </el-form-item>
      <!-- <el-form-item v-if="dataForm.verify_status==2" label="理由" prop="type">
        <el-select v-model="dataForm.verify_opinion" placeholder="请选择">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.name"
              :value="item.value">
            </el-option>
          </el-select>
      </el-form-item> -->
      <el-form-item v-if="dataForm.verify_status==2" label="理由" prop="verify_opinion">
        <el-input type="textarea" :rows="3" maxlength="50" placeholder="" v-model="dataForm.verify_opinion"></el-input>
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
    </span>
  </el-dialog>
</template>

<script>
import { treeDataTranslate } from '@/utils'
import seviceApi from '@/api/serviceApi.js'
export default {
  data () {
    return {
      visible: false,
      is_pass: 1,
      dataForm: {
        id: '0',
        verify_status: null,
        verify_opinion: '',
        verify_remark: ''
      },
      value: 1,
      options: [
        {
          name: '图片内容不符合',
          value: 0
        }, {
          name: '直播时间过长',
          value: 1
        }, {
          name: '其它',
          value: 2
        }
      ],
      dataRule: {
        verify_status: [
          { required: true, message: '请选择审核状态', trigger: 'blur' }
        ]
      }
    }
  },

  methods: {
    init (id) {
      this.visible = true
      this.dataForm.id = id
      this.$nextTick(() => {
        this.$refs['dataForm'].resetFields()
      })
    },
    // 提交
    dataFormSubmit () {
      this.$refs['dataForm'].validate((valid) => {
        if (valid) {
          seviceApi.getWithdrawCheck(this.dataForm).then(res => {
            if (res && res.data.code == 200) {
              this.$message({
                showClose: true,
                message: '审核成功',
                type: 'success'
              })
              this.visible = false
              this.$emit('updataList', 1)
            }
          })
        }
      })
    }

  }
}
</script>

<style lang="scss">
</style>
